<!DOCTYPE html>
<html lang="zh">

<head>
	<th:block th:include="include :: header('项目函件回函')" />
	<link href="../static/layui/css/layui.css" th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	<link href="../static/layui/css/dropdown.css" th:href="@{/layui/css/dropdown.css}" rel="stylesheet" />
	<link href="../static/css/projectDetail.css" th:href="@{/css/projectDetail.css}" rel="stylesheet" />
</head>

<body class="fixed-sidebar full-height-layout gray-bg">
	<!-- 头部导航 链接 -->
	<div class="row border-bottom white-bg dashboard-header headerNav">
		<div class="col-sm-1 logo">
			<div class="icon hidden-xs">
				<i class="fa fa-file-powerpoint-o"></i>
			</div>
			<div class="progressBar">
				<i>20.00%</i>
				<!-- style和 aria-valuenow里的数字代表进度 -->
				<div class="layui-progress" style="height: 5px;">
					<div class="layui-progress-bar " lay-percent="20.00%" style="width: 20%;"></div>
				</div>
			</div>
		</div>
		<div class="col-sm-11 navBar">
			<th:block th:include="include :: projectNavBar" />
		</div>
	</div>
	<!-- 主体部分 -->
	<div class="wrapper wrapper-content">
		<div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="gcgl:reust:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="gcgl:reust:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gcgl:reust:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>
		<div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
	</div>
	<!-- import layui -->
	<th:block th:include="include :: footer" />
	<script th:src="@{/layui/dropdown.js?v=20250801}"></script>
	<th:block th:include="include :: projectDetail" />
	<!-- import layui -->
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('gcgl:fun:edit')}]];
    	var removeFlag = [[${@permission.hasPermi('gcgl:fun:remove')}]];
    	var prefix = ctx + "sj/fun";
    	var datasstatus = [[${@dict.getType('sj_contract_status')}]];
        
        $(function() {
            var options = {
                url: prefix + "/p4list4lai",
                createUrl: prefix + "/add4lai/"+$("#id").val(),
                updateUrl: prefix + "/edit4lai/{id}",
                removeUrl: prefix + "/remove",
                modalName: "收函",
//                 pagination: false,
		        showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sortName: "id desc",
                sortOrder: "",
                queryParams: queryParams,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'projectName',
                    title: '项目名称'
                },
                {
                    field: 'clientName',
                    title: '建设单位'
                },
                {
                    field: 'hfunNo',
                    title: '收函编号'
                },
                {
                    field: 'hfunName',
                    title: '收函名称'
                },
                {
                    field: 'hfunAt',
                    title: '收函时间'
                },
                {
                    field: 'level',
                    title: '等级'
                },
                {
                    field: 'wenj',
                    title: '资料文件',
                    width:'600px',
		            formatter: function(value, item, index) {
		            	let zilwjlink = "";
		            	
		            	if(item.hfunfile!=null){
		            		var n=item.hfunfile.split(",");
			            	for(var i=0;i<n.length;i++){
//			             		var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(n[i]));
			            		var url = n[i];
			            		zilwjlink+="<a href='"+url+"' target='_blank' >"+n[i]+"</a>";
			            	}
		            	}
		            	
		            	return zilwjlink;
		            }
                },
                {
                    field: 'status',
                    title: '状态',
		            formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(datasstatus, item.status);
		            },
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        
        function queryParams(params){
        	var search = $.table.queryParams(params);
        	search.gcProjectid = $("#id").val();
        	return search;
        }
        
    </script>
    
    <!--选中导航 这段js放在每个页面末尾-->
    <script>
		$(()=>{
			setTimeout(()=>{
				selectedNav(5)//第N个被选中 0即
			},100)
		})
		
		function selectedNav(index){
			$('ul.layui-nav').find('.layui-nav-item').eq(index).addClass('layui-this');
		}
	</script>
</body>
</html>